export default { get, set, remove, clear };
const KEYPR = "substat-";

function get(key) {
  let str = null;
  try {
    str = localStorage.getItem(KEYPR + key);
    if (str) {
      str = JSON.parse(str);
    }
  } catch (e) {
    console.log(e);
  } finally {
    return str;
  }
}
function set(key, value) {
  if (value === undefined) return;
  localStorage.setItem(KEYPR + key, JSON.stringify(value));
}
function remove(key) {
  localStorage.removeItem(KEYPR + key);
}
function clear() {
  localStorage.clear();
}
